package com.isnmp.nms.framework.discover.rstype;

import java.util.List;
import java.util.Vector;

import com.isnmp.common.snmp.SNMPFactory;
import com.isnmp.nms.framework.discover.DeviceInfo;
import com.isnmp.nms.framework.discover.ResourceInfo;
import com.isnmp.nms.framework.discover.ResourceSearchMothType;

public class GernalGroupSearchType extends ResourceSearchMothType {
    public List<ResourceInfo> getResoureInfo(DeviceInfo paramDeviceInfo) {
        Vector localVector = new Vector();
        try {
            String str1 = getResourceRSID();
            String str2 = SNMPFactory.getSNMPAPI().getOIDValue(str1, paramDeviceInfo.getSnmpTarget());
            String str3 = getoid(paramDeviceInfo, getDisplayNameCode());
            String str4 = getoid(paramDeviceInfo, getParamCode());
            ResourceInfo localResourceInfo = new ResourceInfo();
            localResourceInfo.setLocalDevice(paramDeviceInfo);
            localResourceInfo.setResourceDesc("OID=" + str1);
            localResourceInfo.setResourceName(str3);
            localResourceInfo.setResourceObjectInfo(str2);
            localResourceInfo.setResourceParam(str4);
            localResourceInfo.setResourceRSIDValue(str2);
            localResourceInfo.setResourceTypeName(getResoureTypeName());
            localResourceInfo.setResrouceRemarks("OID Value=" + str2);
            localVector.add(localResourceInfo);
        } catch (Exception localException) {
            localException.printStackTrace();
        }
        return localVector;
    }

    public String getResourceSearchMoth() {
        return Messages.getString("GernalGroupSearchType.2");
    }

    private String getoid(DeviceInfo paramDeviceInfo, String paramString) throws Exception {
        int i = paramString.indexOf("<");
        if (i < 0)
            return paramString;
        int j = paramString.indexOf(">");
        String str1 = paramString.substring(i + 1, j);
        if (str1.length() > 1) {
            String str2 = SNMPFactory.getSNMPAPI().getOIDValue(str1, paramDeviceInfo.getSnmpTarget());
            StringBuffer localStringBuffer = new StringBuffer(paramString);
            return localStringBuffer.replace(i, j + 1, str2).toString();
        }
        return paramString;
    }
}